import request from '@/config/axios'

export interface ImprovementVO {
  id: number
  qualityImproveCode: string
  productCode: string
  productName: string
  customerName: string
  dictFaultSource: number
  deptId: number
  deptName: string
  feedbackTime: Date
  handlerId: number
  handlerName: string
  dictFaultType: number
  deadline: Date
  problemDescription: string
  causeAnalysis: string
  temporaryMeasure: string
  correctiveMeasure: string
  preventiveMeasure: string
  communicationRecord: string
  fileId: string
  fileName: string
  filePath: string
  dictQualityImproveStatus: number
  creatorName: string
  effectVerify: string
  submitFlag: number
}

// 查询质量管理-品质管理-品质改善管理列表
export const getImprovementPage = async (params) => {
  return await request.get({ url: `/quality/improvement/page`, params })
}

// 查询质量管理-品质管理-品质改善管理详情
export const getImprovement = async (id: number) => {
  return await request.get({ url: `/quality/improvement/get?id=` + id })
}

// 新增质量管理-品质管理-品质改善管理
export const createImprovement = async (data: ImprovementVO) => {
  return await request.post({ url: `/quality/improvement/create`, data })
}

// 新增改善编号-品质管理-品质改善管理
export const createSave = async (data: ImprovementVO) => {
  return await request.post({ url: `/quality/improvement/save`,data})
}

// 修改质量管理-品质管理-品质改善管理
export const updateImprovement = async (data: ImprovementVO) => {
  return await request.put({ url: `/quality/improvement/update`, data })
}

// 删除质量管理-品质管理-品质改善管理
export const deleteImprovement = async (id: number) => {
  return await request.delete({ url: `/quality/improvement/delete?id=` + id })
}

// 导出质量管理-品质管理-品质改善管理 Excel
export const exportImprovement = async (params) => {
  return await request.download({ url: `/quality/improvement/export-excel`, params })
}
